<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>209会议室申请管理</title>
    <link rel="shortcut icon" href="./fonts/favicon.png" />
    <link rel="stylesheet" href="./css/bootstrap.css">
    <link rel="stylesheet" href="./css/history.css">
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <script src="./js/bootstrap.js"></script>
</head>
<body>
<div id="app">
    <nav class="navbar navbar-default navbar-static-top">
        <div class="container">
            <div class="navbar-header">

                <!-- Collapsed Hamburger -->
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                    <span class="sr-only">Toggle Navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <!-- Branding Image -->
                <a class="navbar-brand" href="{{ url('/') }}">
                    {{ config('app.name', 'Laravel') }}
                </a>
            </div>

            <div class="collapse navbar-collapse" id="app-navbar-collapse">
                <!-- Left Side Of Navbar -->
                <ul class="nav navbar-nav">
                    &nbsp;
                </ul>

                <!-- Right Side Of Navbar -->
                <ul class="nav navbar-nav navbar-right">
                    <!-- Authentication Links -->
                    @if (Auth::guest())
                        <li><a href="{{ route('login') }}">登录</a></li>

                    @else
                        <li><a href="{{ url('teacher/index') }}">最新申请</a></li>
                        <li><a href="{{ url('teacher/history')}}">历史记录</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                                {{ Auth::user()->name }} <span class="caret"></span>
                            </a>

                            <ul class="dropdown-menu" role="menu">
                                <li>
                                    <a href="{{ route('logout') }}"
                                       onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                        注销
                                    </a>

                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        {{ csrf_field() }}
                                    </form>
                                </li>
                            </ul>
                        </li>
                    @endif
                </ul>
            </div>
        </div>
    </nav>

    @yield('content')
</div>
<div class="title">209会议室申请管理</div>
<div class="topnav">
    <ul>
        <li><a href="{{url('teacher/index')}}" class="unactive">最新申请</a></li>
        <li><a href="{{url('teacher/history')}}" >历史记录</a></li>
    </ul>
</div>

<div class="content">
    <div class="tabbable tabs-left" >
        <!--日期-->
        <ul id="myTab" class="nav nav-tabs date">
            <li class="active">
                <a href="#time1" data-toggle="tab" id="t1">
                    一月份
                </a>
            </li>
            <li>
                <a href="#time2" data-toggle="tab"  id="t2">
                    二月份
                </a>
            </li>
            <li>
                <a href="#time3" data-toggle="tab"  id="t3">
                    三月份
                </a>
            </li>
            <li>
                <a href="#time4" data-toggle="tab"  id="t4">
                    四月份
                </a>
            </li>
            <li>
                <a href="#time5" data-toggle="tab"  id="t5">
                    五月份
                </a>
            </li>
            <li>
                <a href="#time6" data-toggle="tab"  id="t6">
                    六月份
                </a>
            </li>
            <li>
                <a href="#time7" data-toggle="tab"  id="t7">
                    七月份
                </a>
            </li>
            <li>
                <a href="#time8" data-toggle="tab"  id="t8">
                    八月份
                </a>
            </li>
            <li>
                <a href="#time9" data-toggle="tab"  id="t9">
                    九月份
                </a>
            </li>
            <li>
                <a href="#time10" data-toggle="tab"  id="t10">
                    十月份
                </a>
            </li>
            <li>
                <a href="#time11" data-toggle="tab"  id="t11">
                    十一月份
                </a>
            </li>
            <li>
                <a href="#time12" data-toggle="tab"  id="t12">
                    十二月份
                </a>
            </li>
        </ul>
        <!--时间-->
        <div class="list_content">
            <div id="myTabContent" class="tab-content">
        @for ($i = 1; $i <= 12; $i++)
                    <div class="tab-pane fade in " id="time{{$i}}">

                    @if(!isset($all[$i]))

                        <div class="noapply"><p>暂无历史记录...</p></div>

                    @else

                        @foreach($all[$i] as $apply)
                            <div class="apply">
                                <div class="imgBox">
                                    <img src="{{$apply->file}}" alt="申请图片" class="applyPic">
                                </div>
                                <div class="btnBox">
                                    @if($apply->check_status==-1)
                                    <p>尚未审核</p>
                                    @elseif($apply->check_status==-2)
                                    <p>已拒绝</p>
                                    @elseif($apply->check_status==1)
                                    <p>已通过</p>
                                    @else
                                    <p>状态未知</p>
                                    @endif

                                    <button class="btn btn-danger  delete" value="{{$apply->id}}"  >删除</button>
                                </div>
                                <div class="infoBox">
                                    <div>
                                        <p><span>会议主题:</span>{{$apply->meeting_subject}}</p>
                                    </div>
                                    <div>
                                        <p><span>申请人:</span>{{$apply->applyer_name}}</p>&nbsp;&nbsp;&nbsp;
                                        <p><span>学号:</span>{{$apply->stu_id}}</p>
                                    </div>
                                    <div>
                                        <p><span>电话号码:</span>{{$apply->phone}}</p>&nbsp;&nbsp;&nbsp;
                                        <p><span>邮箱:</span>{{$apply->email}}</p>&nbsp;&nbsp;&nbsp;
                                        <p><span>审核部门:</span>{{$apply->department}}</p>
                                    </div>
                                    <div>
                                        <p><span>申请时间:</span>{{$apply->apply_time}} {{$apply->day}} {{join_time($apply->exact_time)}}</p>
                                    </div>
                                </div>
                            </div>
                        @endforeach

                @endif
                </div>
        @endfor





        <!--弹图 modal-->
        <div id="ShowImage_Form" class="modal">
            <div class="modal-header">
                <button data-dismiss="modal" class="close" type="button">×</button>
            </div>
            <div class="modal-body imgShow" >
                <img src=" " id="picPlus">
            </div>
        </div>
    </div>
</div>









</body>
</html>

<script>
    $(function(){

        //显示当前月
        var myDate = new Date();
        var month = myDate.getMonth()+1;
        $("#t"+month).click();

        //图片放大
        $(".applyPic").click(function(){
            var psrc=$(this).attr("src");
            $("#picPlus").attr("src",psrc)
            $("#ShowImage_Form").modal();
        })

        //删除
        $(".delete").click(function(){
            var id=$(this).val()
            $.ajax({
                type: "post",
                url: "{{url('delete_apply')}}",
                data: {
                    'id':id,
                },
                success: function (response) {
                    if(response.code==200){
                        alert('删除成功')
                        window.location.reload()
                    }
                    else{
                        alert('删除失败')
                        window.location.reload()
                    }
                }
            });
        })

    })
</script>